package com.hopu.oa.dao.management;


import com.hopu.oa.entity.management.AoaAttendsList;
import com.hopu.oa.entity.management.AoaStatusList;
import com.hopu.oa.entity.management.AoaTypeList;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface AttendanceManageDao {


    /*
      @Description : 根据部门，角色 查询 考勤
      @Date   :  2021/11/19
      @Param  : [roleId, deptId]
      @return : java.util.List<com.hopu.oa.entity.management.AoaAttendsList>
     */
    List<AoaAttendsList> queryAttendanceByDeptAndRole(Integer roleId, Integer deptId, int index, int size, String baseKey, int typeId);



    /*
      @Description : 查询状态
      @Date   :  2021/11/19
      @Param  : []
      @return : java.util.List<com.hopu.oa.entity.management.AoaStatusList>
     */

    List<AoaStatusList> queryAllStatus(int tid);


    /*
      @Description : 查询类型
      @Date   :  2021/11/19
      @Param  : []
      @return : java.util.List<com.hopu.oa.entity.management.AoaTypeList>
     */
    @Select("select * from aoa_type_list ")
    List<AoaTypeList> queryAllType();

    @Select("select * from  aoa_attends_list where attends_id = #{aid}")
    AoaAttendsList queryAttendanceById(String aid);


    /*
      @Description : 更新考勤
      @Date   :  2021/11/20
      @Param  : [aid, sid]
      @return : int
     */
    @Update("update aoa_attends_list set status_id = #{sid} where attends_id = #{aid}")
    int updateAttendanceStatusById(String aid, String sid);


    /*
      @Description : 删除
      @Date   :  2021/11/20
      @Param  : [aid]
      @return : boolean
     */
    @Delete("delete from aoa_attends_list where attends_id = #{aid}")
    int deleteAttendanceById(int aid);
}
